#!/bin/bash
# Save the current working directory in an environment variable.
INITIAL_WORKING_DIRECTORY=$(pwd)

# This line changes to current working directory to where
# the analysis.sh file is.
cd "$(dirname "$0")"

# if log file size > 500MB,delete
log_size=`stat -c "%s" nohup.out`
if [ $log_size -gt 500000000 ]
then
   sudo rm nohup.out
fi

source fscv-env/bin/activate
nohup python3 -u TFLite_detection_cam.py --modeldir Sample_TFLite_model/ --resolution 640x480 --threshold 0.7 -k  1398.7544430007654,1400.4935833026389,356.6068924313155,260.3783807011491 -s 0.154 -v False --mode apriltag -c cam_apriltag --disfactor 0.7 2>&1 &


# Go back to where we were before changing into the
# scripts directory.
cd $INITIAL_WORKING_DIRECTORY

exit 0
